package pl.org.lutra.planner.gui.main;

import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

import pl.org.lutra.planner.gui.resources.Text;
import pl.org.lutra.planner.gui.toolbar.PlannerToolbar;
import pl.org.lutra.planner.gui.util.GuiUtil;

public class PlannerFrame extends JFrame {
    private static final long serialVersionUID = -6846117433912327956L;
    
    public PlannerFrame() {
        init();
    }
    
    private void init() {
        setTitle(Text.get("main.window.title"));
        
        initLayout();
        
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        
        setSize(800, 600);
        GuiUtil.center(this, null);
    }
    
    private void initLayout() {
        setLayout(new BorderLayout());
        
        PlannerToolbar ribbon = new PlannerToolbar();
        add(ribbon, BorderLayout.NORTH);
        
        JPanel contentPanel = new JPanel(new GridLayout(2, 1, 10, 10));
        add(contentPanel, BorderLayout.CENTER);
        
        InputPanel inputPanel = new InputPanel();
        ResultPanel resultPanel = new ResultPanel();
        
        contentPanel.add(inputPanel);
        contentPanel.add(resultPanel);
        
        ribbon.setInputPanel(inputPanel);
    }
}
